import socket
import socks
import requests

import json

import os

def get_IP():

	# print(a)

	res = os.system("sudo /etc/init.d/tor restart")
	
	socks.set_default_proxy(socks.SOCKS5,"127.0.0.1",9050)
	socket.socket = socks.socksocket
	a = requests.get("http://checkip.amazonaws.com").text
	if res == 0:
		print("更换ip成功:"+a)
	# a = "https://"+a.split()[0]+":8001"

	# return a

# socks.set_default_proxy(socks.SOCKS5,"127.0.0.1",9050)
# socket.socket = socks.socksocket
# a = requests.get("http://checkip.amazonaws.com").text
# print(a)
# print(type(a))


def get_response():
	pass